﻿
using System.Globalization;
using System.Windows.Media;

namespace TotalApplication.AngelSix
{
    public class StringRGBToBrushConverter : BaseValueConverter<StringRGBToBrushConverter>
    {
        public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var colorString = value.ToString();
            if (!colorString.StartsWith("#"))
                colorString = $"#{colorString}";

            var brush = (new BrushConverter().ConvertFrom(colorString)) as SolidColorBrush;
            return brush ?? Brushes.Transparent;
            //return (SolidColorBrush)(new BrushConverter().ConvertFrom($"#{value}"));
        }

        public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
